﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Layout.master" AutoEventWireup="true"
    CodeBehind="UserManagement.aspx.cs" Inherits="NPMonitor.Web.UserManagement" %>
  <%@ Register Src="~/UserControls/PagerControl.ascx" TagName="PagerControl" TagPrefix="NPM" %>
  <%@ Register Src="~/UserControls/UserInfo.ascx" TagName="UserInfo" TagPrefix="NPM" %>
<%@ Import Namespace="NPMonitor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <div class="Tab">
            <div class="TabTitle">
                <h2>
                    User (<label id="lblUserCount" runat="server" style="font-size: large;"><%=UserCount %></label>items)</h2>
                <ul>
                    <li>Last Refresh：<span> <label id="lblLastRefresh" ><%=DateTime.Now.ToFormatString()%></label></span></li>
                    <li><asp:linkbutton runat="server" class="refresh" id="imgRefresh" onclick="imgRefresh_OnClick" CausesValidation = "false">
                        Refresh</asp:linkbutton></li>
                    <li>
                        <asp:LinkButton ID="lbtnCreateUser" class="create" runat="server" CausesValidation="false"
                            CommandName="Create" Text="Create User" OnClick="lbtnCreateUser_Click" />
                    </li>
                </ul>
                <div class="clear">
                </div>
            </div>
            <div class="TabContent">
                <table cellpadding="0" cellspacing="0" border="0" class="click">
                    <tr class="first">
                        <td width="25px">
                            ID
                        </td>
                        <td width="200px">
                            User Name
                        </td>
                        <td width="200px">
                            Account
                        </td>
                        <td width="280px">
                            Email
                        </td>
                        <td colspan="2">
                            Operations
                        </td>
                    </tr>
                    <asp:Repeater ID="rpUserList" runat="server" OnItemCommand="rpUserList_OnItemCommand" OnItemDataBound ="rpUserList_OnItemDataBound" >
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <%#Eval("UserId")%>
                                </td>
                                <td>
                                    <%#Eval("UserName")%>
                                </td>
                                <td>
                                    <%#Eval("Account")%>
                                </td>
                                <td>
                                    <%#Eval("Mail")%>
                                </td>
                                <td>
                                    <asp:LinkButton ID="lbtnDisable" runat="server" CommandArgument='<%#Eval("UserId")%>' Text ="Disable"
                                        CommandName="DisableUser"/>
                                         <asp:LinkButton ID="lbtnActive" runat="server" CommandArgument='<%#Eval("UserId")%>' Text ="Active"
                                        CommandName="ActiveUser"/>
                                </td>
                                <td>
                                    <asp:LinkButton ID="lbtnEditUser" runat="server" CommandArgument='<%#Eval("UserId")%>' Text ="Edit" 
                                        CommandName="EditUser" />
                                    <asp:LinkButton ID="lbtnDelete" runat="server" CommandArgument='<%#Eval("UserId")%>' Text ="Delete" 
                                        CommandName="DeleteUser" OnClientClick='return confirm("Are you sure to delete?")' />
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
        </div>
        <NPM:PagerControl ID="ctPager" runat="server" />
    </div>
    <asp:PlaceHolder ID="phUserInfo" Visible = "false" runat="server">
        <NPM:UserInfo ID="ctUserInfo" runat="server" />
    </asp:PlaceHolder>
   
</asp:Content>
